<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">

        <xsl:choose>
            <xsl:when test="count(//stock) = 0">
               Pas de stock !!
            </xsl:when>
            <xsl:otherwise>

                <table class="listeComptes">
                    <tr>
                        <td>
                            <b>Magasin</b>
                        </td>
                        <td>
                            <b>Produit</b>
                        </td>
                        <td>
                            <b>Prix</b>
                        </td>
                        <td>
                            <b>Quantité</b>
                        </td>
                        <td>
                            <b>Modifier</b>
                        </td>
                    </tr>

                    <xsl:for-each select="//stock">
                        <tr>
                            <td>
                                <xsl:value-of select="store/name" />
                            </td>
                            <td>
                                <xsl:value-of select="product/name" />
                            </td>
                            <td>
                                <xsl:value-of select="concat(price, ' ', price/@currency)" />
                            </td>
                            <td>
                                <xsl:value-of select="quantity" />
                            </td>
                            <td>
                                <form action="../secured/RemoveStock.do" method="post">
                                    <input name="id_store" value="{store/@id}" type="hidden" />
                                    <input name="id_product" value="{product/@id}" type="hidden" />
                                    <input style="width:40px;" name="quantity" value="{quantity}" />
                                    <input type="submit" value="Supprimer" />
                                </form>
                            </td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:otherwise>
        </xsl:choose>




        
    </xsl:template>
</xsl:stylesheet>